Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix i2c busy / bus busy handling #35

Merged
merged 1 commit into from
Aug 10, 2020

Conversation

dkm
Copy link
Contributor

@dkm dkm commented Jul 21, 2020

Restore previous logic where a transaction starts by waiting for the controler
to be ready and the bus available and then only wait for the controller to be ready
at intermediate step (not the bus to be available as it will be busy).
Modify the i2c_busy_wait to implement this behavior.

fix #34

@thejpster
Copy link
Member

To be clear, this basically reverts 4d50753

@thejpster thejpster requested a review from dtwood July 23, 2020 19:45
@dkm
Copy link
Contributor Author

dkm commented Jul 23, 2020

Not true ! :) It keeps most of these changes, only it won't raise an error when busbsy is set everytime the macro is used, only when the extra argument is provided (eg. at beg of transaction).
It still spins on busy to be clear before reading other bits (which the patch you link fixes).

@thejpster
Copy link
Member

I appreciate the clarification. I find Github diff mode quite hard to grok :/

@dkm
Copy link
Contributor Author

dkm commented Jul 23, 2020

No problem ! And I may still have overlooked something, so feel free to question my choices :) I can still say that previous try to use i2c always failed with the BusBusy error since the @dtwood's changes and now it works correctly for hours. Not a clear proof it fixes something, but at least, it works here :)

tm4c-hal/src/i2c.rs Outdated Show resolved Hide resolved
tm4c-hal/src/i2c.rs Outdated Show resolved Hide resolved
Copy link
Member

@thejpster thejpster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'm happy, but I haven't tested it. Would like to hear from @dtwood before we merge.

Restore previous logic where a transaction starts by waiting for the controler
to be ready and the bus available and then only wait for the controller to be ready
at intermediate step (not the bus to be available as it will be busy).
Modify the i2c_busy_wait to implement this behavior.

fix rust-embedded-community#34
Copy link
Collaborator

@dtwood dtwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would like to hear from @dtwood before we merge.

Sorry, I completely missed this. Have just ordered myself some hardware, but since I can't get openOCD installed on this machine, it's going to take a while until I can test.

The code looks sensible to me (and definitely better to put the loop in the macro, rather than me leaving it out), so if this fixes things then happy to merge.

@dkm
Copy link
Contributor Author

dkm commented Aug 9, 2020

Great, thanks ! I can say that before your changes, i2c was really unstable, after your fix it does not work at all, and the combination of your fix and these changes makes it work flawlessly on my app. It is simple, so can't say it's a very robust test, but it is testing basic things...

@thejpster thejpster merged commit 096a816 into rust-embedded-community:master Aug 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

I2C not working anymore
3 participants